/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * <p>Project: javaseapp - T1
 * <p>Powered by webrx On 2021-08-30 10:44:25
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class T1 {
    public static void main(String[] args) {
        var d1 = LocalDate.of(2021, 3, 15);
        var d2 = LocalDate.now();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String str = LocalDateTime.now().format(dtf);
        System.out.println(str); //2021-08-31 08:26:57
        LocalDateTime dt = LocalDateTime.parse("2021-08-31 08:02:07", dtf);
        System.out.println(dt);//2021-08-31T08:02:07
        DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        System.out.println(LocalDate.now().format(dtf2));//2021-08-31
        DateTimeFormatter dtf3 = DateTimeFormatter.ofPattern("HH:mm:ss");
        System.out.println(LocalTime.now().format(dtf3));//08:28:13


    }
}
